/**
 * @author LKQ
 * @date 2022/3/4 13:13
 * @description 维护一个最小值
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int minStartValue(int[] nums) {
        int min = Integer.MAX_VALUE;
        int sum = 0;
        for(int a: nums) {
            sum += a;
            min = Math.min(min, sum);
        }
        return min < 0 ? 1-min : 1;
    }
}
